<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<%@ page contentType="text/html; charset=UTF-8" %>
<%@include file="../common/admin_head.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title><s:text name="admin_title"/></title>
    <link href="<%=basepath%>/css/loginStyle.css" rel="stylesheet" type="text/css"/>
    <script language="javascript" type="text/javascript" src="<%=basepath%>/js/My97DatePicker/WdatePicker.js"></script>
</head>
<body>

<div class="tabpage">
    <div class="tabpage_cont">
        <ul id="tabs">
            <li class="list current" id="tab_main"><a class="current"> <span class="current">首页</span></a></li>
            <!-- 划过样式如下！ -->
            <!--     <li class="list hover"><a class="hover"> <span class="hover">选项卡一</span></a> <a class="tab_del"></a></li> -->
            <!-- 选中样式如下！ -->
            <!--     <li class="list hover"><a class="hover"> <span class="hover">选项卡一</span></a> <a class="tab_del"></a></li> -->


        </ul>
    </div>
    <div class="tab_moreBOX">
        <a class="tab_more" id="tab_more"></a>
    </div>

    <div class="list_more" style="display: none" id="list_more">
        <ul>
            <li class="more_li"><a>我的主页</a></li>


        </ul>


    </div>
</div>
<img src="<%=basepath%>/images/admin/loading.gif" id="loading"/>
<iframe src="<%=basepath%>/admin/admin_main.action" id="ifm_main" frameborder="no" border="0" marginwidth="0"
        marginheight="0" scrolling="no" allowtransparency="yes" style="display: none"></iframe>
<div style="text-align:left;margin:0px;">
    <div class="pop-msg" id="mesg" style="display: none">
        <div class="pop-msg-main ">

            <p class="pop-msg-tip"> 你有新消息</p>

            <a class="pop-msg-del" id="megdel"></a>

            <p class="pop-msg-text" id="megcontent"></p>
        </div>
    </div>

</div>


</body>
<script type="text/javascript">
    var preid = [];//标签堆栈集合
    var tabswidth = 49;
    iframeload("ifm_main");
    function createIframe(url, id, isreset) {
        if ($("#ifm_" + id).length <= 0) {
            $("#loading").show();
            var id = "ifm_" + id;
            $("body").find("iframe[id*='ifm_']").hide();
            var mainheight = $(window).height();
            var mainwidth = $(window).width();
            $("#ifm_main").after("<iframe   width=" + mainwidth + " heigh=" + mainheight + " src='" + url + "' id='" + id + "' frameborder='no' border='0' marginwidth='0' marginheight='0' scrolling='no' allowtransparency='yes'></iframe>");
            iframeload(id);
        } else {
            if (isreset) {
                $("#ifm_" + id).attr("src", url);
            }

        }
    }
    function createTab(tabname, id) {
        var current_tab = $("#tabs").children("li.current");
        preid.push(current_tab.attr("id").split("_")[1]);
        current_tab.removeClass("current").addClass("hover");
        current_tab.children("a.current").attr("class", "hover");
        current_tab.children("a.hover").children("span").attr("class", "hover");
        if ($("#tab_" + id).length > 0) {
            var current_tab = $("#tab_" + id);
            current_tab.removeClass("hover").addClass("current");
            current_tab.children("a.hover").attr("class", "current");
            current_tab.children("a.current").children("span").attr("class", "current");
            $("body").find("iframe[id*='ifm_']").hide();
            $("#ifm_" + id).show();
            iframeload("ifm_" + id);
//     	var fn = arguments[2] ? arguments[2] : '';
//     	if(fn!=""){
//     		$("#"+"ifm_"+id)[0].contentWindow.eval(fn);
//     	}
        } else {
            //alert($("#tabs").width());
            //alert(tabswidth+4);
// 		if($("#tabs").width()<tabswidth+61){
// 			$("#tabs li:eq(1)").remove();
// 		}
            var tabli = $("<li class=\"list current\" id=\"tab_" + id + "\"><a class=\"current\"> <span class=\"current\">" + tabname + "</span></a><a class=\"tab_del\"></a></li>");
            $("#tabs").append(tabli);
            tabswidth += $("#tabs li:last-child").width() + 2;
        }
    }
    function changeTab(id) {
        var current_tab = $("#tabs").children("li.current");
        current_tab.removeClass("current").addClass("hover");
        current_tab.children("a.current").attr("class", "hover");
        current_tab.children("a.hover").children("span").attr("class", "hover");
        if ($("#tab_" + id).length > 0) {
            var current_tab = $("#tab_" + id);
            current_tab.removeClass("hover").addClass("current");
            current_tab.children("a.hover").attr("class", "current");
            current_tab.children("a.current").children("span").attr("class", "current");
            $("body").find("iframe[id*='ifm_']").hide();
            $("#ifm_" + id).show();
            iframeload("ifm_" + id);
        }
    }
    function iframeload(id) {
        $("#" + id).load(function () {
            $("#loading").hide();
            $("#" + id).show();
            var mainheight = $(window).height();
            var mainwidth = $(window).width();
            $(this).height(mainheight);
            $(this).width(mainwidth);
        });
    }
    $(".tab_del").live("click", function () {
        var parid = $(this).parent().attr("id");
        var ysid = parid.split("_")[1];
        if (preid.length > 0) {
            preid.remove(ysid);
            changeTab(preid[preid.length - 1]);
        }


        $("#ifm_" + ysid).remove();
        $(this).parent().remove();

    });
    function closetab(ysid) {
        if (preid.length > 0) {
            preid.remove(ysid);
            changeTab(preid[preid.length - 1]);
        }
        $("#ifm_" + ysid).remove();
        $("#tab_" + ysid).remove();
    }
    $("span.hover").live("click", function () {
        var parid = $(this).parent().parent().attr("id");
        var id = parid.split("_")[1];
        changeTab(id);
    });
    Array.prototype.remove = function (val) {
        for (var i = 0; i < this.length; i++) {
            if (this[i] == val) {
                this.splice(i, 1);
                i--;
            }
        }
    };

    $("#tab_more").click(function () {
        if ($("#list_more").is(":visible")) {
            $("#list_more").hide();
        } else {
            $("#list_more").show();
        }
    });
    callback = function () {
    };
    function popmeg(option) {
        $("#mesg").slideDown(1000);
        $("#megcontent").html(option.content);
        if (option.callfn) {
            callback = option.callfn;
        }
    }
    $("#megdel").click(function () {
        $("#mesg").slideUp(1000, callback);
    });
    function popclose() {
        $("#mesg").slideUp(1000, callback);
    }
</script>
</html>
